Skip to content

feat: Add docker-sbx runtime support to compiler#45006

Merged
lpcox merged 5 commits into
mainfrom
copilot/feat-add-docker-sbx-runtime-support
Jul 12, 2026
Merged

feat: Add docker-sbx runtime support to compiler#45006
lpcox merged 5 commits into
mainfrom
copilot/feat-add-docker-sbx-runtime-support

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Adds docker-sbx as a sandbox.agent.runtime option, running the agent inside a KVM-isolated Docker sbx microVM while infrastructure containers (Squid, api-proxy, MCP gateway) remain on the host via Docker Compose.

New frontmatter

sandbox:
  agent:
    id: awf
    runtime: docker-sbx
    sudo: true  # required

Compiler changes

New step generators (docker_sbx_install.go):

  • KVM availability fail-fast (lsmod | grep kvm, /dev/kvm writable)
  • Docker secrets fail-fast (DOCKER_PAT, DOCKER_USERNAME non-empty)
  • sbx install via Docker apt repo + sudo apt-get install -y docker-sbx
  • Daemon startup + Docker Hub auth (secrets via env: block, never inline) + policy reset + image pre-pull
  • Pre-flight smoke test: sbx createsbx exec uname -asbx rm

MCP gateway routing — microVM cannot reach 127.0.0.1; for docker-sbx:

  • Port binding changed to 0.0.0.0
  • Gateway domain set to host.docker.internal
  • MCP_GATEWAY_HOST_DOMAIN=host.docker.internal injected into environment

AWF config:

  • --container-runtime sbx added to AWF CLI invocation
  • host.docker.internal added to network.allowDomains
  • network.isolation: true always forced (regardless of sudo: true)

Compile-time validation — rejects:

  • runtime: docker-sbx + runner.topology: arc-dind (no nested virt)
  • runtime: docker-sbx + sudo: false (install requires root)

Strict mode: sudo: true deprecation warning suppressed for docker-sbx (root is a hard requirement, not a choice).

Schema

docker-sbx added to the sandbox.agent.runtime enum in main_workflow_schema.json.

Copilot AI linked an issue Jul 11, 2026 that may be closed by this pull request
13 tasks
Copilot AI and others added 2 commits July 11, 2026 20:26
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Add docker-sbx runtime support to compiler feat: Add docker-sbx runtime support to compiler Jul 11, 2026
Copilot finished work on behalf of lpcox July 11, 2026 20:33
Copilot AI requested a review from lpcox July 11, 2026 20:33
@github-actions

Copy link
Copy Markdown
Contributor

Hey @copilot-swe-agent 👋 — great work adding docker-sbx as a sandbox.agent.runtime option! The implementation looks well-scoped, covering the new step generators, schema update, validation logic, and a dedicated test file (docker_sbx_test.go). This is exactly the kind of focused, agentic contribution the project is built around. The PR looks ready for review! 🚀

Generated by ✅ Contribution Check · 97 AIC · ⌖ 12.9 AIC · ⊞ 6.2K ·

@lpcox lpcox marked this pull request as ready for review July 11, 2026 23:27
Copilot AI review requested due to automatic review settings July 11, 2026 23:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds compiler support for running agents in KVM-isolated Docker sbx microVMs.

Changes:

  • Adds runtime validation, schema support, and AWF configuration.
  • Generates Docker sbx installation, authentication, and smoke-test steps.
  • Routes MCP gateway traffic through host.docker.internal and adds tests.
Show a summary per file
File Description
.changeset/minor-docker-sbx-runtime-support.md Documents the new runtime.
pkg/parser/schemas/main_workflow_schema.json Adds the runtime schema option.
pkg/workflow/awf_config.go Configures microVM network access.
pkg/workflow/awf_helpers.go Adds the AWF sbx runtime argument.
pkg/workflow/codex_engine.go Installs sbx for Codex workflows.
pkg/workflow/docker_sbx_install.go Generates sbx setup steps.
pkg/workflow/docker_sbx_test.go Tests runtime compilation and setup.
pkg/workflow/firewall.go Adds sbx runtime helpers and isolation.
pkg/workflow/mcp_setup_generator.go Routes MCP traffic to the microVM.
pkg/workflow/nodejs.go Installs sbx for npm engines.
pkg/workflow/sandbox.go Defines the new runtime.
pkg/workflow/sandbox_validation.go Validates sudo and runner topology.
pkg/workflow/strict_mode_sandbox_validation.go Exempts required sudo usage.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 13/13 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment thread pkg/workflow/awf_helpers.go Outdated
Comment on lines +617 to +618
if isDockerSbxRuntime(config.WorkflowData) {
awfArgs = append(awfArgs, "--container-runtime", "sbx")
Comment on lines +94 to +95
" set -euo pipefail",
` echo "::group::Start sbx daemon"`,
Comment thread pkg/workflow/docker_sbx_install.go Outdated
Comment on lines +29 to +33
` if ! test -w /dev/kvm; then`,
` echo "::error::/dev/kvm exists but is not writable. The runner must allow access to /dev/kvm."`,
` exit 1`,
` fi`,
` echo "KVM is available and /dev/kvm is writable ✅"`,
Comment thread pkg/workflow/docker_sbx_install.go Outdated
Comment on lines +140 to +143
` echo "y" | sbx create shell --name test-sandbox-direct "${GITHUB_WORKSPACE}"`,
` sbx exec test-sandbox-direct uname -a`,
` sbx stop test-sandbox-direct`,
` sbx rm --force test-sandbox-direct`,
Comment on lines +731 to +734
if isDockerSbxRuntime(workflowData) {
// docker-sbx: publish to 0.0.0.0 so the microVM can reach the gateway via
// host.docker.internal (the Docker bridge gateway, 172.17.0.1).
containerCmd.WriteString(" -p 0.0.0.0:${MCP_GATEWAY_PORT}:${MCP_GATEWAY_PORT}")
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, make sure the branch is up to date with the base branch, and rerun checks once everything is green.

Generated by 👨‍🍳 PR Sous Chef · 12.6 AIC · ⌖ 7.9 AIC · ⊞ 7.5K ·
Comment /souschef to run again

@lpcox

lpcox commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot run the pr-finisher skill

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@lpcox lpcox added the smoke label Jul 11, 2026
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, make sure the branch is up to date with the base branch, and rerun checks once everything is green.

...

Addressed in b7feffc. The branch is up to date with main and local make fmt, make lint, make test-unit, and make test all pass. CI on this new head still needs a maintainer re-trigger because agent pushes here do not start a fresh checks run.

Copilot AI requested a review from gh-aw-bot July 12, 2026 00:00
@lpcox lpcox merged commit b4f3c45 into main Jul 12, 2026
29 of 30 checks passed
@lpcox lpcox deleted the copilot/feat-add-docker-sbx-runtime-support branch July 12, 2026 00:07
Copilot stopped work on behalf of lpcox due to an error July 12, 2026 00:07
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add docker-sbx runtime support to compiler

4 participants